<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.css" rel="stylesheet" />
	</head>

<style>
	a,.mui-title{
		color:#FFFFFF;
	}
	*{
		font-family:PingFang-SC-Medium;
	}
	.mui-bar{
		background: #FE635F;
	}
		body{
	background-color: #FFFFFF;
	}
	.bianji{
		position: absolute;
		right: 10px;
		line-height: 44px;
		font-size:12px;
        font-weight:400;
        color:rgba(255,255,255,1);
	}
	.mui-content{
		position: relative;
		float: left;
		width:100%;
		height: 100%;
	   padding:10px  15px ;
	   background: #FFFFFF;
	   display: inline-block;
	}
	
	.people{
		position: relative;
		float: left;
		width: 100%;
		height: 100px;
		padding-top: 25px;
		padding-bottom: 20px;
		box-sizing: border-box;
	}
	.people>div:nth-child(1){
		width: 55px;
		height: 100%;
		position: relative;
		float: left;
	}
	.people>div:nth-child(1)>img{
			position: relative;
            width: 55px;
			height: 55px;
			border-radius: 50%;			
	}
	.people>div:nth-child(2){
		width: calc(100% -  65px);
		height: 100%;
		margin-left: 10px;
		position: relative;
		padding-top: 6px;
		float: left;
	}
		.people>div:nth-child(2)>div{
			font-size:13px;
font-family:PingFang-SC-Regular;
font-weight:400;
color:rgba(102,102,102,1);
line-height:23px;
		}
	
	.notice{
		position: relative;
		float: left;
		width: 100%;
	}
		.notice>textarea{
		position: relative;
		float: left;
		width: 100%;
		border: none;
		height: 150px;
		text-indent: 2em;
		font-size:15px;
font-family:PingFang-SC-Regular;
font-weight:400;
color:rgba(51,51,51,1);
line-height:23px;
box-sizing: border-box;
border-bottom: 1px solid rgba(236,236,236,1);
border-top:1px solid rgba(236,236,236,1) ;
	}
</style>
	<body>
	  <header class="mui-bar mui-bar-nav">
	  	<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	  	<h1 class="mui-title">群公告</h1>
		<div  class="bianji">编辑</div>
	  </header>
	 <div class="mui-content">
      <!-- <div  class="people">
		<div><img  src="../image/touxiangmy.png" /></div> 
		 <div>
			 <div>陈雪</div>
			 <div>201-07-06</div>
		 </div>
	  </div> -->
      
	  
	  <div class="notice">
		  <textarea disabled  id="textarea"  >希望大家在群里面和谐交流，创建一个平等互助的环境，欢迎常来群里面聊哦！希望大家在群里面和谐交流，创建一个平等互助的环境，欢迎常来群里面聊哦！
			  
		  </textarea>
		  
	  </div>


	 </div>
	</body>
	
	<script src="../js/mui.js"></script>
	<script src="../js/jquery-3.1.1.min.js"></script>
		<script type="text/javascript">
		     	mui.init({
		     		beforeback: function() {　　　　
		     		var list = plus.webview.currentWebview().opener();　　　　
		     			  //refresh是A页面自定义事件
		     		mui.fire(list, 'refresh');
		     			 //返回true,继续页面关闭逻辑
		     		return true;
		     		},
		     	});
				mui.plusReady(function() {
					var url = plus.storage.getItem('url');
					var user = plus.storage.getItem('user');
					user = JSON.parse(user);
					var web = plus.webview.currentWebview();
					var qunid = web.qunid;
					var qunnotices = '';
					mui.post(url+'/juyou/Grouping/getquns',{token:user.token,qunid:qunid},function(res){
						if(res.code==200){
							$("#textarea").text(res.data.qun.notices);
							qunnotices = res.data.qun.notices;
						}else{
							mui.toast(res.msg);
						}
					})
					
					
				var height = document.body.clientHeight;
				$(".mui-content").css("height", height)
				//点击编辑
					$(document).on("click",".bianji",function(){
						var value=$(this).text();
						if(value=="编辑"){
							$(this).text("完成")
							document.getElementById("textarea").removeAttribute("disabled")
						}else{
							var notices = $("#textarea").val();
							if(qunnotices==notices){
								mui.toast('你没有修改公告');
								$(this).text("编辑")
								document.getElementById("textarea").setAttribute("disabled","disabled")
								return;
							}
							plus.nativeUI.showWaiting();
							mui.post(url+'/juyou/Grouping/changequnnotices',{token:user.token,notices:notices,qunid:qunid},function(res){
								plus.nativeUI.closeWaiting();
								if(res.code==200){
									mui.toast(res.msg);
									setTimeout(function(){
										mui.back();
									},1500)
								}else{
									mui.toast(res.msg);
									setTimeout(function(){
										location.reload();
									},1500)
								}
							})
						// $(this).text("编辑")
						// document.getElementById("textarea").setAttribute("disabled","disabled")
						}
						
					})
			})
			
			
			
			
			
	</script>

</html>
